package com.ruoyi.web.controller.mall;

import com.agri.api.service.farmer.IFarmerProductsService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.agri.api.service.mall.IMallGoodsService;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.model.mall.dto.req.GoodListReq;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author huixh
 */
@RestController
@RequestMapping("/wx/farmer")
@Api("商品分类控制器")
public class MallGoodsController extends BaseController {

    @Resource
    private IMallGoodsService mallGoodsService;

    @Resource
    private IFarmerProductsService farmerProductsService;
    @Anonymous
    @PostMapping ("/goods/{id}")
    public AjaxResult getGoodsDetail(@PathVariable("id") Long goodId){
        return AjaxResult.success();
    }

    @Anonymous
    @PostMapping ("/categories/list")
    public AjaxResult getGoodsListByCategoryId(@RequestBody GoodListReq goodListReq){
        return success(getDataTable(farmerProductsService.selectGoodsListByCategoryId(goodListReq)));
    }
}
